package com.tanhua.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.exception.BusinessException;
import com.tanhua.interceptor.UserHolder;
import model.vo.ErrorResult;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class BaiduService {
    @DubboReference
    private UserLocationApi userLocationApi;

    public void updateLocation(Double longitude, Double latitude, String addrStr) {
        boolean flag = userLocationApi.updateLocation(UserHolder.getUserId(), longitude, latitude, addrStr);
        if (!flag) throw new BusinessException(ErrorResult.error());
    }
}
